console.log("loading: callback.utils.js");
var CallbackUtils=
{
		count:0,
		callbacks:{},
		// Return callback id
		Add:function(callbackId,func,params)
		{
			if (func==undefined)
			{
				console.error('Add():func - is undefined');
			}
			if (callbackId==undefined)
			{
				callbackId= new Date().valueOf()+'!'+this.count++;
			}
			this.callbacks[callbackId]={f:func,p:params};
			return callbackId;
		},
		Remove:function(callbackId)
		{
			delete this.callbacks[callbackId];
		},
		Exec:function (callbackId,params)
		{
			var tmp =this.callbacks[callbackId];
			if (tmp == undefined || tmp.f==undefined)
			{
				return undefined;
			}
			return tmp.f(params,tmp.p);
		}
};